home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / Drag.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  13.2 KB  |  599 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Drag.a
  3. ;
  4. ;    Contains:    Drag and Drop Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Drag and Drop 1.1
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__DRAG__') = 'UNDEFINED' THEN
  21. __DRAG__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  25.     include 'AppleEvents.a'
  26.     ENDIF
  27. ;        include 'Errors.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'Types.a'                                            ;
  30. ;        include 'Memory.a'                                            ;
  31. ;            include 'MixedMode.a'                                    ;
  32. ;        include 'OSUtils.a'                                        ;
  33. ;        include 'Events.a'                                            ;
  34. ;            include 'Quickdraw.a'                                    ;
  35. ;                include 'QuickdrawText.a'                            ;
  36. ;        include 'EPPC.a'                                            ;
  37. ;            include 'AppleTalk.a'                                    ;
  38. ;            include 'Files.a'                                        ;
  39. ;            include 'PPCToolbox.a'                                    ;
  40. ;            include 'Processes.a'                                    ;
  41. ;        include 'Notification.a'                                    ;
  42.  
  43.     IF &TYPE('__TEXTEDIT__') = 'UNDEFINED' THEN
  44.     include 'TextEdit.a'
  45.     ENDIF
  46.  
  47. ; Flavor Flags 
  48. flavorSenderOnly                EQU        $00000001            ; flavor is available to sender only 
  49. flavorSenderTranslated            EQU        $00000002            ; flavor is translated by sender 
  50. flavorNotSaved                    EQU        $00000004            ; flavor should not be saved 
  51. flavorSystemTranslated            EQU        $00000100            ; flavor is translated by system 
  52.  
  53. ; typedef unsigned long     FlavorFlags
  54.  
  55. ; Drag Attributes 
  56. dragHasLeftSenderWindow            EQU        $00000001            ; drag has left the source window since TrackDrag 
  57. dragInsideSenderApplication        EQU        $00000002            ; drag is occurring within the sender application 
  58. dragInsideSenderWindow            EQU        $00000004            ; drag is occurring within the sender window 
  59.  
  60. ; typedef unsigned long     DragAttributes
  61.  
  62. ; Special Flavor Types 
  63. flavorTypeHFS                    EQU        'hfs '                ; flavor type for HFS data 
  64. flavorTypePromiseHFS            EQU        'phfs'                ; flavor type for promised HFS data 
  65. flavorTypeDirectory                EQU        'diry'
  66.  
  67. ; Drag Tracking Handler Messages 
  68. dragTrackingEnterHandler        EQU        1                    ; drag has entered handler 
  69. dragTrackingEnterWindow            EQU        2                    ; drag has entered window 
  70. dragTrackingInWindow            EQU        3                    ; drag is moving within window 
  71. dragTrackingLeaveWindow            EQU        4                    ; drag has exited window 
  72. dragTrackingLeaveHandler        EQU        5                    ; drag has exited handler 
  73.  
  74. ; typedef short             DragTrackingMessage
  75.  
  76. ; Drag Drawing Procedure Messages 
  77. dragRegionBegin                    EQU        1                    ; initialize drawing 
  78. dragRegionDraw                    EQU        2                    ; draw drag feedback 
  79. dragRegionHide                    EQU        3                    ; hide drag feedback 
  80. dragRegionIdle                    EQU        4                    ; drag feedback idle time 
  81. dragRegionEnd                    EQU        5                    ; end of drawing 
  82.  
  83. ; typedef short             DragRegionMessage
  84.  
  85. ; Zoom Acceleration 
  86. zoomNoAcceleration                EQU        0                    ; use linear interpolation 
  87. zoomAccelerate                    EQU        1                    ; ramp up step size 
  88. zoomDecelerate                    EQU        2                    ; ramp down step size 
  89.  
  90. ; typedef short             ZoomAcceleration
  91. ; Drag Manager Data Types 
  92. ; typedef unsigned long     DragReference
  93. ; typedef unsigned long     ItemReference
  94. ; typedef ResType             FlavorType
  95. ; HFS Flavors 
  96. HFSFlavor                 RECORD    0
  97. fileType                 ds.l   1        ; offset: $0 (0)        ; file type 
  98. fileCreator                 ds.l   1        ; offset: $4 (4)        ; file creator 
  99. fdFlags                     ds.w   1        ; offset: $8 (8)        ; Finder flags 
  100. fileSpec                 ds     FSSpec    ; offset: $A (10)        ; file system specification 
  101. sizeof                     EQU *            ; size:   $50 (80)
  102.                         ENDR
  103.  
  104. ; typedef struct HFSFlavor     HFSFlavor
  105. PromiseHFSFlavor         RECORD    0
  106. fileType                 ds.l   1        ; offset: $0 (0)        ; file type 
  107. fileCreator                 ds.l   1        ; offset: $4 (4)        ; file creator 
  108. fdFlags                     ds.w   1        ; offset: $8 (8)        ; Finder flags 
  109. promisedFlavor             ds.l   1        ; offset: $A (10)        ; promised flavor containing an FSSpec 
  110. sizeof                     EQU *            ; size:   $E (14)
  111.                         ENDR
  112.  
  113. ; typedef struct PromiseHFSFlavor  PromiseHFSFlavor
  114. ; Application-Defined Drag Handler Routines 
  115. ; typedef DragTrackingHandlerUPP  DragTrackingHandler
  116. ; typedef DragReceiveHandlerUPP  DragReceiveHandler
  117. ; Application-Defined Routines 
  118. ; typedef DragSendDataUPP     DragSendDataProc
  119. ; typedef DragInputUPP         DragInputProc
  120. ; typedef DragDrawingUPP     DragDrawingProc
  121. ; Drag Manager Routines 
  122. ; Installing and Removing Drag Handlers 
  123. ;
  124. ; pascal OSErr InstallTrackingHandler(DragTrackingHandler trackingHandler, WindowPtr theWindow, void *handlerRefCon)
  125. ;
  126.     IF ¬ GENERATINGCFM THEN
  127.         Macro
  128.         _InstallTrackingHandler
  129.             moveq    #1,d0
  130.             dc.w     $ABED
  131.         EndM
  132.     ELSE
  133.         IMPORT_CFM_FUNCTION    InstallTrackingHandler
  134.     ENDIF
  135.  
  136. ;
  137. ; pascal OSErr InstallReceiveHandler(DragReceiveHandler receiveHandler, WindowPtr theWindow, void *handlerRefCon)
  138. ;
  139.     IF ¬ GENERATINGCFM THEN
  140.         Macro
  141.         _InstallReceiveHandler
  142.             moveq    #2,d0
  143.             dc.w     $ABED
  144.         EndM
  145.     ELSE
  146.         IMPORT_CFM_FUNCTION    InstallReceiveHandler
  147.     ENDIF
  148.  
  149. ;
  150. ; pascal OSErr RemoveTrackingHandler(DragTrackingHandler trackingHandler, WindowPtr theWindow)
  151. ;
  152.     IF ¬ GENERATINGCFM THEN
  153.         Macro
  154.         _RemoveTrackingHandler
  155.             moveq    #3,d0
  156.             dc.w     $ABED
  157.         EndM
  158.     ELSE
  159.         IMPORT_CFM_FUNCTION    RemoveTrackingHandler
  160.     ENDIF
  161.  
  162. ;
  163. ; pascal OSErr RemoveReceiveHandler(DragReceiveHandler receiveHandler, WindowPtr theWindow)
  164. ;
  165.     IF ¬ GENERATINGCFM THEN
  166.         Macro
  167.         _RemoveReceiveHandler
  168.             moveq    #4,d0
  169.             dc.w     $ABED
  170.         EndM
  171.     ELSE
  172.         IMPORT_CFM_FUNCTION    RemoveReceiveHandler
  173.     ENDIF
  174.  
  175. ; Creating and Disposing Drag References 
  176. ;
  177. ; pascal OSErr NewDrag(DragReference *theDragRef)
  178. ;
  179.     IF ¬ GENERATINGCFM THEN
  180.         Macro
  181.         _NewDrag
  182.             moveq    #5,d0
  183.             dc.w     $ABED
  184.         EndM
  185.     ELSE
  186.         IMPORT_CFM_FUNCTION    NewDrag
  187.     ENDIF
  188.  
  189. ;
  190. ; pascal OSErr DisposeDrag(DragReference theDragRef)
  191. ;
  192.     IF ¬ GENERATINGCFM THEN
  193.         Macro
  194.         _DisposeDrag
  195.             moveq    #6,d0
  196.             dc.w     $ABED
  197.         EndM
  198.     ELSE
  199.         IMPORT_CFM_FUNCTION    DisposeDrag
  200.     ENDIF
  201.  
  202. ; Adding Drag Item Flavors 
  203. ;
  204. ; pascal OSErr AddDragItemFlavor(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, void *dataPtr, Size dataSize, FlavorFlags theFlags)
  205. ;
  206.     IF ¬ GENERATINGCFM THEN
  207.         Macro
  208.         _AddDragItemFlavor
  209.             moveq    #7,d0
  210.             dc.w     $ABED
  211.         EndM
  212.     ELSE
  213.         IMPORT_CFM_FUNCTION    AddDragItemFlavor
  214.     ENDIF
  215.  
  216. ;
  217. ; pascal OSErr SetDragItemFlavorData(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, const void *dataPtr, Size dataSize, unsigned long dataOffset)
  218. ;
  219.     IF ¬ GENERATINGCFM THEN
  220.         Macro
  221.         _SetDragItemFlavorData
  222.             moveq    #9,d0
  223.             dc.w     $ABED
  224.         EndM
  225.     ELSE
  226.         IMPORT_CFM_FUNCTION    SetDragItemFlavorData
  227.     ENDIF
  228.  
  229. ; Providing Drag Callback Procedures 
  230. ;
  231. ; pascal OSErr SetDragSendProc(DragReference theDragRef, DragSendDataProc sendProc, void *dragSendRefCon)
  232. ;
  233.     IF ¬ GENERATINGCFM THEN
  234.         Macro
  235.         _SetDragSendProc
  236.             moveq    #10,d0
  237.             dc.w     $ABED
  238.         EndM
  239.     ELSE
  240.         IMPORT_CFM_FUNCTION    SetDragSendProc
  241.     ENDIF
  242.  
  243. ;
  244. ; pascal OSErr SetDragInputProc(DragReference theDragRef, DragInputProc inputProc, void *dragInputRefCon)
  245. ;
  246.     IF ¬ GENERATINGCFM THEN
  247.         Macro
  248.         _SetDragInputProc
  249.             moveq    #11,d0
  250.             dc.w     $ABED
  251.         EndM
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION    SetDragInputProc
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal OSErr SetDragDrawingProc(DragReference theDragRef, DragDrawingProc drawingProc, void *dragDrawingRefCon)
  258. ;
  259.     IF ¬ GENERATINGCFM THEN
  260.         Macro
  261.         _SetDragDrawingProc
  262.             moveq    #12,d0
  263.             dc.w     $ABED
  264.         EndM
  265.     ELSE
  266.         IMPORT_CFM_FUNCTION    SetDragDrawingProc
  267.     ENDIF
  268.  
  269. ;
  270. ; pascal OSErr TrackDrag(DragReference theDragRef, const EventRecord *theEvent, RgnHandle theRegion)
  271. ;
  272.     IF ¬ GENERATINGCFM THEN
  273.         Macro
  274.         _TrackDrag
  275.             moveq    #13,d0
  276.             dc.w     $ABED
  277.         EndM
  278.     ELSE
  279.         IMPORT_CFM_FUNCTION    TrackDrag
  280.     ENDIF
  281.  
  282. ; Getting Drag Item Information 
  283. ;
  284. ; pascal OSErr CountDragItems(DragReference theDragRef, unsigned short *numItems)
  285. ;
  286.     IF ¬ GENERATINGCFM THEN
  287.         Macro
  288.         _CountDragItems
  289.             moveq    #14,d0
  290.             dc.w     $ABED
  291.         EndM
  292.     ELSE
  293.         IMPORT_CFM_FUNCTION    CountDragItems
  294.     ENDIF
  295.  
  296. ;
  297. ; pascal OSErr GetDragItemReferenceNumber(DragReference theDragRef, unsigned short index, ItemReference *theItemRef)
  298. ;
  299.     IF ¬ GENERATINGCFM THEN
  300.         Macro
  301.         _GetDragItemReferenceNumber
  302.             moveq    #15,d0
  303.             dc.w     $ABED
  304.         EndM
  305.     ELSE
  306.         IMPORT_CFM_FUNCTION    GetDragItemReferenceNumber
  307.     ENDIF
  308.  
  309. ;
  310. ; pascal OSErr CountDragItemFlavors(DragReference theDragRef, ItemReference theItemRef, unsigned short *numFlavors)
  311. ;
  312.     IF ¬ GENERATINGCFM THEN
  313.         Macro
  314.         _CountDragItemFlavors
  315.             moveq    #16,d0
  316.             dc.w     $ABED
  317.         EndM
  318.     ELSE
  319.         IMPORT_CFM_FUNCTION    CountDragItemFlavors
  320.     ENDIF
  321.  
  322. ;
  323. ; pascal OSErr GetFlavorType(DragReference theDragRef, ItemReference theItemRef, unsigned short index, FlavorType *theType)
  324. ;
  325.     IF ¬ GENERATINGCFM THEN
  326.         Macro
  327.         _GetFlavorType
  328.             moveq    #17,d0
  329.             dc.w     $ABED
  330.         EndM
  331.     ELSE
  332.         IMPORT_CFM_FUNCTION    GetFlavorType
  333.     ENDIF
  334.  
  335. ;
  336. ; pascal OSErr GetFlavorFlags(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, FlavorFlags *theFlags)
  337. ;
  338.     IF ¬ GENERATINGCFM THEN
  339.         Macro
  340.         _GetFlavorFlags
  341.             moveq    #18,d0
  342.             dc.w     $ABED
  343.         EndM
  344.     ELSE
  345.         IMPORT_CFM_FUNCTION    GetFlavorFlags
  346.     ENDIF
  347.  
  348. ;
  349. ; pascal OSErr GetFlavorDataSize(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, Size *dataSize)
  350. ;
  351.     IF ¬ GENERATINGCFM THEN
  352.         Macro
  353.         _GetFlavorDataSize
  354.             moveq    #19,d0
  355.             dc.w     $ABED
  356.         EndM
  357.     ELSE
  358.         IMPORT_CFM_FUNCTION    GetFlavorDataSize
  359.     ENDIF
  360.  
  361. ;
  362. ; pascal OSErr GetFlavorData(DragReference theDragRef, ItemReference theItemRef, FlavorType theType, void *dataPtr, Size *dataSize, unsigned long dataOffset)
  363. ;
  364.     IF ¬ GENERATINGCFM THEN
  365.         Macro
  366.         _GetFlavorData
  367.             moveq    #20,d0
  368.             dc.w     $ABED
  369.         EndM
  370.     ELSE
  371.         IMPORT_CFM_FUNCTION    GetFlavorData
  372.     ENDIF
  373.  
  374. ;
  375. ; pascal OSErr GetDragItemBounds(DragReference theDragRef, ItemReference theItemRef, Rect *itemBounds)
  376. ;
  377.     IF ¬ GENERATINGCFM THEN
  378.         Macro
  379.         _GetDragItemBounds
  380.             moveq    #21,d0
  381.             dc.w     $ABED
  382.         EndM
  383.     ELSE
  384.         IMPORT_CFM_FUNCTION    GetDragItemBounds
  385.     ENDIF
  386.  
  387. ;
  388. ; pascal OSErr SetDragItemBounds(DragReference theDragRef, ItemReference theItemRef, const Rect *itemBounds)
  389. ;
  390.     IF ¬ GENERATINGCFM THEN
  391.         Macro
  392.         _SetDragItemBounds
  393.             moveq    #22,d0
  394.             dc.w     $ABED
  395.         EndM
  396.     ELSE
  397.         IMPORT_CFM_FUNCTION    SetDragItemBounds
  398.     ENDIF
  399.  
  400. ;
  401. ; pascal OSErr GetDropLocation(DragReference theDragRef, AEDesc *dropLocation)
  402. ;
  403.     IF ¬ GENERATINGCFM THEN
  404.         Macro
  405.         _GetDropLocation
  406.             moveq    #23,d0
  407.             dc.w     $ABED
  408.         EndM
  409.     ELSE
  410.         IMPORT_CFM_FUNCTION    GetDropLocation
  411.     ENDIF
  412.  
  413. ;
  414. ; pascal OSErr SetDropLocation(DragReference theDragRef, const AEDesc *dropLocation)
  415. ;
  416.     IF ¬ GENERATINGCFM THEN
  417.         Macro
  418.         _SetDropLocation
  419.             moveq    #24,d0
  420.             dc.w     $ABED
  421.         EndM
  422.     ELSE
  423.         IMPORT_CFM_FUNCTION    SetDropLocation
  424.     ENDIF
  425.  
  426. ; Getting Information About a Drag 
  427. ;
  428. ; pascal OSErr GetDragAttributes(DragReference theDragRef, DragAttributes *flags)
  429. ;
  430.     IF ¬ GENERATINGCFM THEN
  431.         Macro
  432.         _GetDragAttributes
  433.             moveq    #25,d0
  434.             dc.w     $ABED
  435.         EndM
  436.     ELSE
  437.         IMPORT_CFM_FUNCTION    GetDragAttributes
  438.     ENDIF
  439.  
  440. ;
  441. ; pascal OSErr GetDragMouse(DragReference theDragRef, Point *mouse, Point *pinnedMouse)
  442. ;
  443.     IF ¬ GENERATINGCFM THEN
  444.         Macro
  445.         _GetDragMouse
  446.             moveq    #26,d0
  447.             dc.w     $ABED
  448.         EndM
  449.     ELSE
  450.         IMPORT_CFM_FUNCTION    GetDragMouse
  451.     ENDIF
  452.  
  453. ;
  454. ; pascal OSErr SetDragMouse(DragReference theDragRef, Point pinnedMouse)
  455. ;
  456.     IF ¬ GENERATINGCFM THEN
  457.         Macro
  458.         _SetDragMouse
  459.             moveq    #27,d0
  460.             dc.w     $ABED
  461.         EndM
  462.     ELSE
  463.         IMPORT_CFM_FUNCTION    SetDragMouse
  464.     ENDIF
  465.  
  466. ;
  467. ; pascal OSErr GetDragOrigin(DragReference theDragRef, Point *initialMouse)
  468. ;
  469.     IF ¬ GENERATINGCFM THEN
  470.         Macro
  471.         _GetDragOrigin
  472.             moveq    #28,d0
  473.             dc.w     $ABED
  474.         EndM
  475.     ELSE
  476.         IMPORT_CFM_FUNCTION    GetDragOrigin
  477.     ENDIF
  478.  
  479. ;
  480. ; pascal OSErr GetDragModifiers(DragReference theDragRef, short *modifiers, short *mouseDownModifiers, short *mouseUpModifiers)
  481. ;
  482.     IF ¬ GENERATINGCFM THEN
  483.         Macro
  484.         _GetDragModifiers
  485.             moveq    #29,d0
  486.             dc.w     $ABED
  487.         EndM
  488.     ELSE
  489.         IMPORT_CFM_FUNCTION    GetDragModifiers
  490.     ENDIF
  491.  
  492. ; Drag Highlighting 
  493. ;
  494. ; pascal OSErr ShowDragHilite(DragReference theDragRef, RgnHandle hiliteFrame, Boolean inside)
  495. ;
  496.     IF ¬ GENERATINGCFM THEN
  497.         Macro
  498.         _ShowDragHilite
  499.             moveq    #30,d0
  500.             dc.w     $ABED
  501.         EndM
  502.     ELSE
  503.         IMPORT_CFM_FUNCTION    ShowDragHilite
  504.     ENDIF
  505.  
  506. ;
  507. ; pascal OSErr HideDragHilite(DragReference theDragRef)
  508. ;
  509.     IF ¬ GENERATINGCFM THEN
  510.         Macro
  511.         _HideDragHilite
  512.             moveq    #31,d0
  513.             dc.w     $ABED
  514.         EndM
  515.     ELSE
  516.         IMPORT_CFM_FUNCTION    HideDragHilite
  517.     ENDIF
  518.  
  519. ;
  520. ; pascal OSErr DragPreScroll(DragReference theDragRef, short dH, short dV)
  521. ;
  522.     IF ¬ GENERATINGCFM THEN
  523.         Macro
  524.         _DragPreScroll
  525.             moveq    #32,d0
  526.             dc.w     $ABED
  527.         EndM
  528.     ELSE
  529.         IMPORT_CFM_FUNCTION    DragPreScroll
  530.     ENDIF
  531.  
  532. ;
  533. ; pascal OSErr DragPostScroll(DragReference theDragRef)
  534. ;
  535.     IF ¬ GENERATINGCFM THEN
  536.         Macro
  537.         _DragPostScroll
  538.             moveq    #33,d0
  539.             dc.w     $ABED
  540.         EndM
  541.     ELSE
  542.         IMPORT_CFM_FUNCTION    DragPostScroll
  543.     ENDIF
  544.  
  545. ;
  546. ; pascal OSErr UpdateDragHilite(DragReference theDragRef, RgnHandle updateRgn)
  547. ;
  548.     IF ¬ GENERATINGCFM THEN
  549.         Macro
  550.         _UpdateDragHilite
  551.             moveq    #34,d0
  552.             dc.w     $ABED
  553.         EndM
  554.     ELSE
  555.         IMPORT_CFM_FUNCTION    UpdateDragHilite
  556.     ENDIF
  557.  
  558. ; Drag Manager Utilities 
  559. ;
  560. ; pascal Boolean WaitMouseMoved(Point initialMouse)
  561. ;
  562.     IF ¬ GENERATINGCFM THEN
  563.         Macro
  564.         _WaitMouseMoved
  565.             moveq    #35,d0
  566.             dc.w     $ABED
  567.         EndM
  568.     ELSE
  569.         IMPORT_CFM_FUNCTION    WaitMouseMoved
  570.     ENDIF
  571.  
  572. ;
  573. ; pascal OSErr ZoomRects(const Rect *fromRect, const Rect *toRect, short zoomSteps, ZoomAcceleration acceleration)
  574. ;
  575.     IF ¬ GENERATINGCFM THEN
  576.         Macro
  577.         _ZoomRects
  578.             moveq    #36,d0
  579.             dc.w     $ABED
  580.         EndM
  581.     ELSE
  582.         IMPORT_CFM_FUNCTION    ZoomRects
  583.     ENDIF
  584.  
  585. ;
  586. ; pascal OSErr ZoomRegion(RgnHandle region, Point zoomDistance, short zoomSteps, ZoomAcceleration acceleration)
  587. ;
  588.     IF ¬ GENERATINGCFM THEN
  589.         Macro
  590.         _ZoomRegion
  591.             moveq    #37,d0
  592.             dc.w     $ABED
  593.         EndM
  594.     ELSE
  595.         IMPORT_CFM_FUNCTION    ZoomRegion
  596.     ENDIF
  597.  
  598.     ENDIF ; __DRAG__
  599.